package cn.ffcs.uec.common.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import cn.ffcs.uec.common.dao.UecBdDefdocDao;
import cn.ffcs.uec.common.vo.UecBdDefdoc;
import cn.ffcs.uom.common.constants.BaseUnitConstants;
import cn.ffcs.uom.common.dao.BaseDaoImpl;
import cn.ffcs.uom.common.util.StrUtil;

@Repository("uecBdDefdocDao")
@Transactional
public class UecBdDefdocDaoImpl extends BaseDaoImpl implements UecBdDefdocDao {

	@Override
	public UecBdDefdoc qryUecBdDefdoc(UecBdDefdoc uecBdDefdoc) {
		StringBuilder sb = new StringBuilder(
				" SELECT * FROM UEC_BD_DEFDOC T  WHERE 1=1 ");
		List<Object> params = new ArrayList<Object>();
		sb.append(" AND T.ENABLESTATE = '2' ");
		if (uecBdDefdoc != null) {
			if (!StrUtil.isNullOrEmpty(uecBdDefdoc.getPkDefdoc())) {
				sb.append(" AND T.pk_defdoc = ? ");
				params.add(uecBdDefdoc.getPkDefdoc());
			}
			List<UecBdDefdoc> list = super.jdbcFindList(sb.toString(),
					params, UecBdDefdoc.class);
			if (list.size() > 0 && list != null) {
				return list.get(0);
			}
		}
		return null;
	}


}
